<!DOCTYPE html>
<html lang='zh-cn' xmlns:th="http://www.thymeleaf.org">>
<head>
  <meta charset='utf-8'>
  <meta http-equiv='X-UA-Compatible' content='IE=edge'>
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <meta name="renderer" content="webkit">
    <link rel="stylesheet" href="../../../lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="../../../css/public.css" media="all">
  <title>企业内部工时管理系统-Bug - 禅道</title>
<script>window.config={"webRoot":"\/","debug":0,"appName":"","cookieLife":30,"requestType":"PATH_INFO","requestFix":"-","moduleVar":"m","methodVar":"f","viewVar":"t","defaultView":"html","themeRoot":"\/theme\/","currentModule":"bug","currentMethod":"browse","clientLang":"zh-cn","requiredFields":"","router":"\/index.php","save":"\u4fdd\u5b58","runMode":"","timeout":30000,"pingInterval":""};
window.lang={"submitting":"\u7a0d\u5019...","save":"\u4fdd\u5b58","expand":"\u5c55\u5f00\u5168\u90e8","timeout":"\u8fde\u63a5\u8d85\u65f6\uff0c\u8bf7\u68c0\u67e5\u7f51\u7edc\u73af\u5883\uff0c\u6216\u91cd\u8bd5\uff01"};

</script>
<script>config.onlybody = "no";</script><script src='../../../js/all.js'></script>
<link rel='stylesheet' href='../../../css/zh-cn.default.css' type='text/css' media='screen'>
<style>.ke-toolbar .ke-outline[data-name='savetemplate'] {display: none}
#modulemenu .nav #dropMenu #searchResult .closed{text-decoration:none;}
.nav #moreMenus{cursor: pointer;}

#batchCreateForm .input-group, #batchEditForm .input-group,
#batchCreateForm .input-group .form-control, #batchEditForm .input-group .form-control {position: static;}
#batchCreateForm .input-group .colorpicker, #batchEditForm .input-group .colorpicker {z-index: 2;}
#batchCreateForm .input-group .colorpicker.open, #batchEditForm .input-group .colorpicker.open {z-index: 5;}
.closed, .closed a{color:gray; text-decoration:line-through;}
.resolved, .resolved a{color:#8EC21F; text-decoration:none;}
.tree .closed, .tree .closed a{color:#003366; text-decoration:none;}
.confirm0 {color:gray;}
.confirm1 {color:green;}
td.delayed{color:#fff; background: #e84e0f!important;}

.datatable-wrapper .table-datatable .datatable-row td {height:37px;}

#createActionMenu .dropdown-menu {width:100%;}

.dropdown-menu.with-search {padding: 0; min-width: 150px; overflow: hidden; max-height: 302px;}
.dropdown-menu > .menu-search .input-group {width:100%;}
.dropdown-menu > .menu-search .input-group-addon {position: absolute; right: 10px; top: 0; z-index: 10; background: none; border: none; color: #666}
.dropdown-menu > .menu-search .form-control {border: none!important; box-shadow: none!important; border-top: 1px solid #ddd!important;}
.dropdown-menu > li > a {text-align: left;}
.dropdown-list {display: block; padding: 0; max-height: 270px; overflow-y: auto;}
.dropdown-list > li > a {display: block; padding: 3px 20px; clear: both; font-weight: normal; line-height: 1.53846154; color: #141414; white-space: nowrap;}
.dropdown-list > li > a:hover,
.dropdown-list > li > a:focus {color: #1a4f85;text-decoration: none;background-color: #ddd;}

th.c-confirmed {text-align: center;}
.c-severity{overflow: hidden; white-space: nowrap;}
.c-id {text-overflow:ellipsis; white-space:nowrap;}

.body-modal #mainMenu>.btn-toolbar{width: auto;}
</style><link rel='icon' href='https://demo.zentao.net/favicon.ico' type='image/x-icon'>
<link rel='shortcut icon' href='https://demo.zentao.net/favicon.ico' type='image/x-icon'>
<!--[if lt IE 9]>
<script src='/js/html5shiv/min.js?v=12.5.3'></script>
<script src='/js/respond/min.js?v=12.5.3'></script>
<![endif]-->
<!--[if lt IE 10]>
<script src='/js/jquery/placeholder/min.js?v=12.5.3'></script>
<![endif]-->
</head>
<body>
<style>
.picker-single .picker-selection-remove{z-index: 1000;}
.picker-selection-single:after, .picker-multi.picker-focus .picker-selections:before{font-family: ZentaoIcon !important; content: '\f0d7' !important;}
</style>
<script>
var chooseUsersToMail = '选择要发信通知的用户...';
if($.fn.picker)
{
    $(document).ready(function()
    {
        $(".picker-select[data-pickertype!='remote']").picker({chosenMode: true});
        $("[data-pickertype='remote']").each(function()
        {
            var pickerremote = $(this).attr('data-pickerremote');
            $(this).picker({chosenMode: true, remote: pickerremote});
        })
    });
}
</script>
<header id='header'>
  <div id='mainHeader'>
    <div class='container'>
      <hgroup id='heading'>
                <h1 id='companyname' title='易软天创'><a href='index1.html'>易软天创</a>
</h1>
      </hgroup>
      <nav id='navbar'><ul class='nav nav-default'>
<li data-id='my'><a href='index.html'><span> 我的地盘</span></a></li>
<li data-id='product'><a href='product-index-no.html'>产品</a></li>
<li data-id='project'><a href='project-index-no.html'>项目</a></li>
<li class='active' data-id='qa'><a href='index2.html' class='active'>测试</a></li>
<li class='divider'></li><li data-id='doc'><a href='index3.html'>文档</a></li>
<li data-id='report'><a href='report-productSummary.html'>统计</a></li>
<li class='divider'></li><li data-id='company'><a href='company-browse.html'>组织</a></li>
<li data-id='admin'><a href='index4.html'>后台</a></li>
</ul>
</nav>
      <div id='toolbar'>
        <div id="userMenu">
          <div id='searchbox'><div class='input-group'><div class='input-group-btn'><a data-toggle='dropdown' class='btn btn-link'><span id='searchTypeName'>Bug</span> <span class='caret'></span></a><input type='hidden' name='searchType' id='searchType' value='bug'>
<ul id='searchTypeMenu' class='dropdown-menu'><li class='selected'><a href='javascript:$.setSearchType("bug");' data-value='bug'>Bug</a></li><li><a href='javascript:$.setSearchType("story");' data-value='story'>需求</a></li><li><a href='javascript:$.setSearchType("task");' data-value='task'>任务</a></li><li><a href='javascript:$.setSearchType("testcase");' data-value='testcase'>用例</a></li><li><a href='javascript:$.setSearchType("project");' data-value='project'>项目</a></li><li><a href='javascript:$.setSearchType("product");' data-value='product'>产品</a></li><li><a href='javascript:$.setSearchType("user");' data-value='user'>用户</a></li><li><a href='javascript:$.setSearchType("build");' data-value='build'>版本</a></li><li><a href='javascript:$.setSearchType("release");' data-value='release'>发布</a></li><li><a href='javascript:$.setSearchType("productplan");' data-value='productplan'>产品计划</a></li><li><a href='javascript:$.setSearchType("testtask");' data-value='testtask'>测试单</a></li><li><a href='javascript:$.setSearchType("doc");' data-value='doc'>文档</a></li><li><a href='javascript:$.setSearchType("caselib");' data-value='caselib'>用例库</a></li><li><a href='javascript:$.setSearchType("testreport");' data-value='testreport'>测试报告</a></li></ul></div><input id='searchInput' class='form-control search-input' type='search' onclick='this.value=""' onkeydown='if(event.keyCode==13) $.gotoObject();' placeholder='编号(ctrl+g)'></div><a href='javascript:$.gotoObject();' class='btn btn-link' id='searchGo'>GO!</a></div>
          <ul id="userNav" class="nav nav-default">
            <li><a class='dropdown-toggle' data-toggle='dropdown'><span class='user-name'>guest</span><span class='caret'></span></a><ul class='dropdown-menu pull-right'><li class='dropdown-submenu'><a href='javascript:;'>主题</a><ul class='dropdown-menu pull-left'><li class='selected'><a href='javascript:selectTheme("default");' data-value='default'>禅道蓝（默认）</a></li><li><a href='javascript:selectTheme("green");' data-value='green'>叶兰绿</a></li><li><a href='javascript:selectTheme("red");' data-value='red'>赤诚红</a></li><li><a href='javascript:selectTheme("purple");' data-value='purple'>玉烟紫</a></li><li><a href='javascript:selectTheme("pink");' data-value='pink'>芙蕖粉</a></li><li><a href='javascript:selectTheme("blackberry");' data-value='blackberry'>露莓黑</a></li><li><a href='javascript:selectTheme("classic");' data-value='classic'>经典蓝</a></li></ul></li><li class='dropdown-submenu'><a href='javascript:;'>Language</a><ul class='dropdown-menu pull-left'><li class='selected'><a href='javascript:selectLang("zh-cn");'>简体</a></li><li><a href='javascript:selectLang("zh-tw");'>繁體</a></li><li><a href='javascript:selectLang("en");'>English</a></li><li><a href='javascript:selectLang("de");'>Deutsch</a></li><li><a href='javascript:selectLang("fr");'>Français</a></li><li><a href='javascript:selectLang("vi");'>Tiếng Việt</a></li><li><a href='javascript:selectLang("ja");'>日本語</a></li></ul></li><li class="divider"></li><li class='dropdown-submenu'><a data-toggle='dropdown'>帮助</a><ul class='dropdown-menu pull-left'><li><a href='40.html' class='open-help-tab' target='_blank' rel='noopener noreferrer'>手册</a>
</li><li><a href='misc-changeLog.html' class='iframe' data-width='800' data-headerless='true' data-backdrop='true' data-keyboard='true'>修改日志</a>
</li></ul></li>
<li><a href='misc-about.html' class='about iframe' data-width='1050' data-headerless='true' data-backdrop='true' data-keyboard='true' data-class='modal-about'>关于禅道</a>
</li><li class="divider"></li><li><a href='user-login.html'>登录</a>
</li></ul></li>
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div id='subHeader'>
    <div class='container'>
      <div id="pageNav" class='btn-toolbar'><div class="btn-group angle-btn"><div class="btn-group"><a href='qa-index-no.html' class='btn'>测试主页</a>
</div></div><div class='btn-group angle-btn'><div class='btn-group'><button data-toggle='dropdown' type='button' class='btn btn-limit' id='currentItem' title='企业内部工时管理系统'>企业内部工时管理系统 <span class='caret'></span></button><div id='dropMenu' class='dropdown-menu search-list' data-ride='searchList' data-url='/product-ajaxGetDropMenu-2-bug-browse-.html'><div class="input-control search-box has-icon-left has-icon-right search-example"><input type="search" class="form-control search-input"><label class="input-control-icon-left search-icon"><i class="icon icon-search"></i></label><a class="input-control-icon-right search-clear-btn"><i class="icon icon-close icon-sm"></i></a></div></div></div></div></div>
      <nav id='subNavbar'><ul class='nav nav-default'>
<li class=' active' data-id='bug'><a href='bug-browse-2.html'>Bug</a>
</li>
<li class='dropdown dropdown-hover ' data-id='testcase'><a href='javascript:;'>用例<span class='caret'></span></a>
<ul class='dropdown-menu'><li class='' data-id='feature'><a href='javascript:;'>功能测试</a>
</li></ul></li>
<li class=' ' data-id='testtask'><a href='testtask-browse-2.html'>测试单</a>
</li>
<li class=' ' data-id='report'><a href='javascript:;'>报告</a>
</li>
<li class=' ' data-id='testsuite'><a href='javascript:;'>套件</a>
</li>
<li class=' ' data-id='caselib'><a href='caselib-browse.html'>用例库</a>
</li>
</ul>
</nav>
      <div id="pageActions"><div class='btn-toolbar'></div></div>
    </div>
  </div>
  </header>

<main id='main'>
  <div class='container'>
<style>
#setShowModule {margin-left: 30px;}
</style>
<script>
$(function()
{
        $('#sidebar .cell .text-center:last').append("<a href='#showModuleModal' data-toggle='modal' class='btn btn-info btn-wide'>模块设置</a><hr class='space-sm' />");
    
    var addSettingButton = function()
    {
        var $btnToolbar = $('#main .table-header .btn-toolbar:first');
        if($btnToolbar.length > 0)
        {
                        var $dropdown = $('<div class="dropdown"><button id="tableCustomBtn" type="button" class="btn btn-link" data-toggle="dropdown"><i class="icon-cog"></i></button></div>');
            var $dropmenu = $('<ul class="dropdown-menu pull-right"></ul>');
            $dropmenu.append("<li><a href='/datatable-ajaxCustom-bug-browse.html' data-toggle='modal' data-type='ajax'>自定义列</a></li>");
            $dropmenu.append("<li><a href='javascript:saveDatatableConfig(\"mode\", \"datatable\", true);' id='switchToDatatable'>切换到高级表格</a></li>");
            $dropdown.append($dropmenu).appendTo($btnToolbar);
        }
    };
    $('#main .main-table').on('tableReload', addSettingButton);
    addSettingButton();

    $('#setShowModule').click(function()
    {
        if('guest' == 'guest') return;
        datatableId   = 'bugBrowse';
        var value     = $('#showModuleModal input[name="showModule"]:checked').val();
        var allModule = $('#showModuleModal input[name="showAllModule"]:checked').val();
        if(typeof allModule === 'undefined') allModule = false;
        $.ajax(
        {
            type: "POST",
            dataType: 'json',
            data:
            {
                target: datatableId,
                name: 'showModule',
                value: value,
                allModule: allModule,
            },
            success:function(){window.location.reload();},
            url: '/datatable-ajaxSave.html'
        });
    });

    window.saveDatatableConfig = function(name, value, reload, global)
    {
        if('guest' == 'guest') return;
        var datatableId = 'bugBrowse';
        if(typeof value === 'object') value = JSON.stringify(value);
        if(typeof global === 'undefined') global = 0;
        $.ajax(
        {
            type: "POST",
            dataType: 'json',
            data: {target: datatableId, name: name, value: value, global: global},
            success:function(e){if(reload) window.location.reload();},
            url: '/datatable-ajaxSave.html'
        });
        $.get(createLink('score', 'ajax', "method=switchToDataTable"));
    };
});
</script>

<div class="modal fade" id="showModuleModal" tabindex="-1" role="dialog">
  <div class="modal-dialog w-600px">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal"><i class="icon icon-close"></i></button>
        <h4 class="modal-title"><i class="icon-cog"></i> 模块设置</h4>
      </div>
      <div class="modal-body">
        <form class='form-condensed' method='post' target='hiddenwin' action='/datatable-ajaxSave.html'>
          <table class='table table-form'>
            <tr>
              <td class='w-150px'>列表页是否显示模块名</td>
              <td><label class='radio-inline'><input type='radio' name='showModule' value='0' checked='checked' id='showModule0'> 不显示</label><label class='radio-inline'><input type='radio' name='showModule' value='base' id='showModulebase'> 只显示一级模块</label><label class='radio-inline'><input type='radio' name='showModule' value='end' id='showModuleend'> 只显示最后一级模块</label></td>
            </tr>
                        <tr>
              <td colspan='2' class='text-center'><button type='button' id='setShowModule' class='btn btn-primary'>保存</button></td>
            </tr>
          </table>
        </form>
      </div>
    </div>
  </div>
</div>
<script>browseType = "all";</script>
<script>moduleID = 0;</script>
<script>bugBrowseType = "all";</script>
<script>flow = "full";</script>
<script>productID = 2;</script>
<script>branch = 0;</script>

<!--"所有模块"导航栏-->
<div id="mainMenu" class="clearfix">
  <div id="sidebarHeader">
    <div class="title">
      所有模块    </div>
  </div>


<!--  <div class="btn-toolbar pull-left">-->
<!--    <a href='javascript:;' class='btn btn-link btn-active-text'><span class='text'>所有</span> <span class='label label-light label-badge'>15</span></a>-->
<!--<a href='javascript:;' class='btn btn-link '><span class='text'>未关闭</span></a>-->
<!--<a href='javascript:;' class='btn btn-link '><span class='text'>由我创建</span></a>-->
<!--<a href='javascript:;' class='btn btn-link '><span class='text'>指派给我</span></a>-->
<!--<a href='javascript:;' class='btn btn-link '><span class='text'>由我解决</span></a>-->
<!--<a href='javascript:;' class='btn btn-link '><span class='text'>待关闭</span></a>-->
<!--<a href='javascript:;' class='btn btn-link '><span class='text'>未解决</span></a>-->
<!--<div class='btn-group'><a href='javascript:;' data-toggle='dropdown' class='btn btn-link '>更多 <span class='caret'></span></a><ul class='dropdown-menu'><li><a href='javascript:;' class='btn btn-link '><span class='text'>未确认</span></a>-->
<!--</li><li><a href='javascript:;' class='btn btn-link '><span class='text'>未指派</span></a>-->
<!--</li><li><a href='javascript:;' class='btn btn-link '><span class='text'>久未处理</span></a>-->
<!--</li><li><a href='javascript:;' class='btn btn-link '><span class='text'>被延期</span></a>-->
<!--</li><li><a href='javascript:;' class='btn btn-link '><span class='text'>过期Bug</span></a>-->
<!--</li><li><a href='javascript:;' class='btn btn-link '><span class='text'>需求变动</span></a>-->
<!--</li></ul></div>    <a class="btn btn-link querybox-toggle" id='bysearchTab'><i class="icon icon-search muted"></i> 搜索</a>-->
<!--  </div>-->


  <div class="btn-toolbar pull-right">
    <a href='javascript:;' class='btn btn-link '><i class='icon-common-report icon-bar-chart muted'></i> <span class='text'>报表</span></a>
    <div class='btn-group'>
      <button type='button' class='btn btn-link dropdown-toggle' data-toggle='dropdown'>
        <i class="icon icon-export muted"></i> <span class="text"> 导出</span> <span class="caret"></span></button>
      
      <ul class='dropdown-menu' id='exportActionMenu'>
        <li><a href='javascript:;' class='export'>导出数据</a>
</li>      </ul>
    </div>
            <a href='javascript:;' class='btn btn-secondary'><i class='icon icon-plus'></i>批量提Bug</a>
<a href='/bugTest/bug/bugEdit' class='btn btn-primary'><i class='icon icon-plus'></i>提Bug</a>
          </div>
</div>
<!--“所有模块”下方模块信息-->
<div id="mainContent" class="main-row fade">
  <div class="side-col" id="sidebar">
    <div class="sidebar-toggle"><i class="icon icon-angle-left"></i></div>
    <div class="cell">
            <hr class="space">
      <div class="text-center text-muted"><div>您现在还没有模块信息</div><div>请维护测试模块</div></div>
      <hr class="space">
                  <div class="text-center">
        <a href='javascript:;' class='btn btn-info btn-wide'>维护模块</a>
        <hr class="space-sm">
      </div>
    </div>
  </div>
  <div class="main-col">
    <div class="cell" id="queryBox" data-module='bug'></div>
            <form class='main-table table-bug' method='post' id='bugForm' data-ride='table'>
      <div class="table-header fixed-right">
        <nav class="btn-toolbar pull-right"></nav>
      </div>
            <div class="table-responsive">
                <table class="layui-table" id="test"  lay-filter="test">
                    <thead>
                    <tr>
                        <th lay-data="{type:'checkbox', width:20}"></th>
                        <th lay-data="{field:'bugId', type:'numbers', width:40, sort: true}">ID</th>
                        <th lay-data="{field:'bugName', width:100}">Bug标题</th>
                        <th lay-data="{field:'bugStatus', width:100}">状态</th>
                        <th lay-data="{field:'bugTime', width:160 , sort: true}">创建日期</th>
                        <th lay-data="{field:'bugDuty', width:160}">指派给</th>
                        <th lay-data="{field:'bugBeta', width:160 , sort: true}">影响版本</th>
                        <th lay-data="{field:'option', width:200 , toolbar: '#optBar'}">操作</th>
                    </tr>
                    </thead>
                </table>
                <div id="pageTool"></div>

                <script type="text/html" id="currentTableBar">
                    <a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="edit">编辑</a>
                    <a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a>
                </script>

                <script type="text/html" id="optBar">
                    <a class="layui-btn layui-btn-xs" lay-event="detail">查看</a>
                    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
                    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
                </script>
      </div>
    </form>
      </div>
</div>
<script>
$('#module' + moduleID).closest('li').addClass('active');
var branchID = $.cookie('bugBranch');
$('#branch' + branchID).closest('li').addClass('active');
</script>
</div><script>
$.initSidebar();
</script>

<iframe frameborder='0' name='hiddenwin' id='hiddenwin' scrolling='no' class='debugwin hidden'></iframe>

</main><footer id='footer'>
  <div class="container">
    <ul class='breadcrumb'><li><a href='index.html'>禅道</a>
</li><li><a href='index2.html'>测试</a>
</li><li class='active'><a href='bug-browse-2.html' title="企业内部工时管理系统">企业内部工时管理系统</a>
</li><li class='active'>Bug</li></ul>    <div id='poweredBy'>
      <small class='muted'><a href='index5.html' class='link-aiux' target='_blank'>Designed by <strong>艾体验</strong></a></small> &nbsp;
      <a href='index6.html' target='_blank'><i class='icon-zentao'></i> 禅道12.5.3</a> &nbsp;
      <a href='professional.html' target='_blank' id='proLink' class='text-important'>专业版 <i class='text-danger icon-pro-version'></i></a> &nbsp;           </div>
  </div>
</footer>
<div id="noticeBox"></div>
<script src="../../../lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script>
    layui.use(['form', 'table'], function () {
        var $ = layui.jquery,
            form = layui.form,
            table = layui.table;
        //******************************layui实现分页的第二种方法**************************************
        var laypage = layui.laypage;
        //执行一个laypage实例
        laypage.render({
            elem: 'pageTool', //注意，这里的 test1 是 ID，不用加 # 号
            limit:10
            ,limits:[5, 10, 20, 30, 40, 50]
            ,count: [[${pageInfo.total}]] //数据总数，从服务端得到
            ,jump: function(obj, first){
                //obj包含了当前分页的所有参数，比如：
                console.log(obj.curr); //得到当前页，以便向服务端请求对应页的数据。
                console.log(obj.limit); //得到每页显示的条数

                //首次不执行
                if (!first) {
                    table.reload('test', {
                        url: '/bugTest/bug'
                        ,where: {'curPage':obj.curr,'pageSize':obj.limit, 'bugName':'', 'bugStatus':'', 'bugTime':'', 'bugDuty':'', 'bugBeta':''} //设定异步数据接口的额外参数
                        //,height: 300
                    });
                    /*table.render({
                        elem: '#test'
                        ,url: '/back/user/list' //数据接口
                        ,method: 'post',
                        ,where:{'curPage':obj.curr,'pageSize':obj.limit}
                    });*/
                }

            }
        });
        // ******************************************************************************************
        //
        // ******************************layui实现分页的第一种方法**************************************
        // 只需要添加request，limits，page参数设置，如果需要添加条件查询再增加where属性设置即可，代码如下所示：
        // 转换静态表格
        table.init('test', {
            limit: 10 //注意：请务必确保 limit 参数（默认：10）是与你服务端限定的数据条数一致
            //支持所有基础参数
            ,url: '/bugTest/bug'
            ,method: 'post'
            ,where:{'bugName':"", 'bugStatus':"", 'bugTime':"", 'bugDuty':"", 'bugBeta':""}
            //,request: {
            //    pageName: 'curr' //页码的参数名称，默认：page
            //    ,limitName: 'nums' //每页数据量的参数名，默认：limit
            //}
            ,toolbar: '#toolbarDemo'
            ,defaultToolbar: ['filter', 'exports', 'print', {
                title: '提示',
                layEvent: 'LAYTABLE_TIPS',
                icon: 'layui-icon-tips'
            }],
            //limits: [5, 10, 15, 20, 25, 50, 100],
            //page: true,
            skin: 'line'
        });

        // 监听搜索操作
        form.on('submit(data-search-btn)', function (data) {
            var result = JSON.stringify(data.field);
            layer.alert(result, {
                title: '最终的搜索信息'
            });

            //执行搜索重载
            table.reload('currentTableId', {
                page: {
                    curr: 1
                }
                , where: {
                    searchParams: result
                }
            }, 'data');

            return false;
        });

        /**
         * toolbar监听事件
         */
        table.on('toolbar(currentTableFilter)', function (obj) {
            if (obj.event === 'templates.add') {  // 监听添加操作
                var index = layer.open({
                    title: '添加用户',
                    type: 2,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: 'bug-create.html',
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
            } else if (obj.event === 'delete') {  // 监听删除操作
                var checkStatus = table.checkStatus('currentTableId')
                    , data = checkStatus.data;
                layer.alert(JSON.stringify(data));
            }
        });

        //监听表格复选框选择
        table.on('checkbox(currentTableFilter)', function (obj) {
            console.log(obj)
        });

        table.on('tool(currentTableFilter)', function (obj) {
            var data = obj.data;
            if (obj.event === 'edit') {

                var index = layer.open({
                    title: '编辑用户',
                    type: 2,
                    shade: 0.2,
                    maxmin:true,
                    shadeClose: true,
                    area: ['100%', '100%'],
                    content: 'bug-edit.html',
                });
                $(window).on("resize", function () {
                    layer.full(index);
                });
                return false;
            } else if (obj.event === 'delete') {
                layer.confirm('真的删除行么', function (index) {
                    obj.del();
                    layer.close(index);
                });
            }
        });

    });
</script>



<script>
/* Alert got messages. */
needPing = false;
$(function()
{
    var windowBlur = false;
    if(window.Notification)
    {
        window.onblur  = function(){windowBlur = true;}
        window.onfocus = function(){windowBlur = false;}
    }
    setInterval(function()
    {
        $.get(createLink('message', 'ajaxGetMessage', "windowBlur=" + (windowBlur ? '1' : '0')), function(data)
        {
            if(!windowBlur)
            {
                $('#noticeBox').append(data);
                adjustNoticePosition();
            }
            else
            {
                if(data)
                {
                    if(typeof data == 'string') data = $.parseJSON(data);
                    if(typeof data.message == 'string') notifyMessage(data);
                }
            }
        });
    }, 300000);
})

</script>

<script>$(function()
{
    var page = window.page || '';
    var flow = window.flow;

    $('#subNavbar a[data-toggle=dropdown]').parent().addClass('dropdown dropdown-hover');

    if(page == 'create' || page == 'edit' || page == 'assignedto' || page == 'confirmbug')
    {
        oldProductID = $('#product').val();
    }

    if(window.flow != 'full')
    {
        $('.querybox-toggle').click(function()
        {
            $(this).parent().toggleClass('active');
        });
    }
});

/**
 * Load all fields.
 * 
 * @param  int $productID 
 * @access public
 * @return void
 */
function loadAll(productID)
{
    if(page == 'create') 
    {
        loadProjectTeamMembers(productID);
        setAssignedTo();
    }

    if(typeof(changeProductConfirmed) != 'undefined' && !changeProductConfirmed)
    {
        firstChoice = confirm(confirmChangeProduct);
        changeProductConfirmed = true;    // Only notice the user one time.

        if(!firstChoice)
        {
            $('#product').val(oldProductID);//Revert old product id if confirm is no.
            $('#product').trigger("chosen:updated");
            $('#product').chosen();
            return true;
        }

        loadAll(productID);
    }
    else
    {
        $('#taskIdBox').innerHTML = '<select id="task"></select>';  // Reset the task.
        $('#task').chosen();
        loadProductBranches(productID)
        loadProductModules(productID); 
        loadProductProjects(productID); 
        loadProductBuilds(productID);
        loadProductplans(productID);
        loadProductStories(productID);
    }
}

/**
 * Load by branch.
 * 
 * @access public
 * @return void
 */
function loadBranch()
{
    $('#taskIdBox').innerHTML = '<select id="task"></select>';  // Reset the task.
    $('#task').chosen();
    productID = $('#product').val();
    loadProductModules(productID);
    loadProductProjects(productID); 
    loadProductBuilds(productID);
    loadProductplans(productID);
    loadProductStories(productID);
}

/**
  *Load all builds of one project or product.
  *
  * @param  object $object
  * @access public
  * @return void
  */
function loadAllBuilds(object)
{
    if(page == 'resolve')
    {
        oldResolvedBuild = $('#resolvedBuild').val() ? $('#resolvedBuild').val() : 0;
        link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=0&index=0&type=all');
        $('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen()});
    }
    else
    {
        productID = $('#product').val();
        projectID = $('#project').val();

        var buildBox = '';
        if(page == 'edit') buildBox = $(object).closest('.input-group').attr('id');

        if(projectID)
        {
            loadAllProjectBuilds(projectID, productID, buildBox);
        }
        else
        {
            loadAllProductBuilds(productID, buildBox);
        }
    }
}

/** 
  * Load all builds of the project.
  *
  * @param  int    $projectID
  * @param  int    $productID
  * @param  string $buildBox
  * @access public
  * @return void
  */
function loadAllProjectBuilds(projectID, productID, buildBox)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    if(page == 'create')
    {
        oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;
        link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&needCreate=true&type=all');
        $.get(link, function(data)
        {
            if(!data) data = '<select id="openedBuild" name="openedBuild" class="form-control" multiple=multiple></select>';
            $('#openedBuild').replaceWith(data);
            $('#openedBuild_chosen').remove();
            $('#openedBuild').next('.picker').remove();
            $("#openedBuild").chosen();
            notice();
        })
    }
    if(page == 'edit')
    {
        if(buildBox == 'openedBuildBox')
        {
            link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&needCreate=true&type=all');
            $('#openedBuildBox').load(link, function(){$(this).find('select').chosen()});
        }
        if(buildBox == 'resolvedBuildBox')
        {
            link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch + '&index=0&type=all');
            $('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen()});
        }
    }
}

/** 
  * Load all builds of the product.
  *
  * @param  int    $productID
  * @param  string $buildBox
  * @access public
  * @return void
  */
function loadAllProductBuilds(productID, buildBox)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    if(page == 'create') 
    {
        link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&type=all');
        $.get(link, function(data)
        {
            if(!data) data = '<select id="openedBuild" name="openedBuild" class="form-control" multiple=multiple></select>';
            $('#openedBuild').replaceWith(data);
            $('#openedBuild_chosen').remove();
            $('#openedBuild').next('.picker').remove();
            $("#openedBuild").chosen();
            notice();
        })
    }
    if(page == 'edit')
    {
        if(buildBox == 'openedBuildBox')
        {
            link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch + '&index=0&type=all');
            $('#openedBuildBox').load(link, function(){$(this).find('select').chosen()});
        }
        if(buildBox == 'resolvedBuildBox')
        {
            link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch' + branch + '&index=0&type=all');
            $('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen()});
        }
    }
}

/**
 * Load product's modules.
 * 
 * @param  int    $productID 
 * @access public
 * @return void
 */
function loadProductModules(productID)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    link = createLink('tree', 'ajaxGetOptionMenu', 'productID=' + productID + '&viewtype=bug&branch=' + branch + '&rootModuleID=0&returnType=html&fieldID=&needManage=true');
    $('#moduleIdBox').load(link, function()
    {   
        $(this).find('select').chosen()
        if(typeof(bugModule) == 'string') $('#moduleIdBox').prepend("<span class='input-group-addon' style='border-left-width: 1px;'>" + bugModule + "</span>");
    });
}

/**
 * Load product stories 
 * 
 * @param  int    $productID 
 * @access public
 * @return void
 */
function loadProductStories(productID)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleId=0&storyID=' + oldStoryID);
    $('#storyIdBox').load(link, function(){$('#story').chosen();});
}

/**
 * Load projects of product. 
 * 
 * @param  int    $productID 
 * @access public
 * @return void
 */
function loadProductProjects(productID)
{
    required = $('#project_chosen').hasClass('required');
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;

    link = createLink('product', 'ajaxGetProjects', 'productID=' + productID + '&projectID=' + oldProjectID + '&branch=' + branch);
    $('#projectIdBox').load(link, function()
    {
        $(this).find('select').chosen();
        if(required) $(this).addClass('required');
    });
}

/**
 * Load product plans.
 * 
 * @param  productID $productID 
 * @access public
 * @return void
 */
function loadProductplans(productID)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    link = createLink('productplan', 'ajaxGetProductplans', 'productID=' + productID + '&branch=' + branch);
    $('#planIdBox').load(link, function(){$(this).find('select').chosen()});
}

/**
 * Load product builds. 
 * 
 * @param  productID $productID 
 * @access public
 * @return void
 */
function loadProductBuilds(productID)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);

    if(page == 'create')
    {
        $.get(link, function(data)
        {
            if(!data) data = '<select id="openedBuild" name="openedBuild" class="form-control" multiple=multiple></select>';
            $('#openedBuild').replaceWith(data);
            $('#openedBuild_chosen').remove();
            $('#openedBuild').next('.picker').remove();
            $("#openedBuild").chosen();
            notice();
        })
    }
    else
    {
        $('#openedBuildBox').load(link, function(){$(this).find('select').chosen()});
        link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
        $('#resolvedBuildBox').load(link, function(){$(this).find('select').chosen()});
    }
}

/**
 * Load project related bugs and tasks.
 * 
 * @param  int    $projectID 
 * @access public
 * @return void
 */
function loadProjectRelated(projectID)
{
    if(projectID)
    {
        loadProjectTasks(projectID);
        loadProjectStories(projectID);
        loadProjectBuilds(projectID);
        loadAssignedTo(projectID);
    }
    else
    {
        $('#taskIdBox').innerHTML = '<select id="task"></select>';  // Reset the task.
        loadProductStories($('#product').val());
        loadProductBuilds($('#product').val());
    }
}

/**
 * Load project tasks.
 * 
 * @param  projectID $projectID 
 * @access public
 * @return void
 */
function loadProjectTasks(projectID)
{
    link = createLink('task', 'ajaxGetProjectTasks', 'projectID=' + projectID + '&taskID=' + oldTaskID);
    $.post(link, function(data)
    {
        if(!data) data = '<select id="task" name="task" class="form-control"></select>';
        $('#task').replaceWith(data);
        $('#task_chosen').remove();
        $('#task').next('.picker').remove();
        $("#task").chosen();
    })
}

/**
 * Load project stories.
 * 
 * @param  projectID $projectID 
 * @access public
 * @return void
 */
function loadProjectStories(projectID)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    link = createLink('story', 'ajaxGetProjectStories', 'projectID=' + projectID + '&productID=' + $('#product').val() + '&branch=' + branch + '&moduleID=0&storyID=' + oldStoryID);
    $('#storyIdBox').load(link, function(){$('#story').chosen();});
}

/**
 * Load builds of a project.
 * 
 * @param  int      $projectID 
 * @access public
 * @return void
 */
function loadProjectBuilds(projectID)
{
    branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    productID = $('#product').val();
    oldOpenedBuild = $('#openedBuild').val() ? $('#openedBuild').val() : 0;

    if(page == 'create')
    {
        link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + "&branch=" + branch + "&index=0&needCreate=true");
        $.get(link, function(data)
        {
            if(!data) data = '<select id="openedBuild" name="openedBuild" class="form-control" multiple=multiple></select>';
            $('#openedBuild').replaceWith(data);
            $('#openedBuild').val(oldOpenedBuild);
            $('#openedBuild_chosen').remove();
            $('#openedBuild').next('.picker').remove();
            $("#openedBuild").chosen();
            notice();
        })
    }
    else
    {
        link = createLink('build', 'ajaxGetProjectBuilds', 'projectID=' + projectID + '&productID=' + productID + '&varName=openedBuild&build=' + oldOpenedBuild + '&branch=' + branch);
        $('#openedBuildBox').load(link, function(){$(this).find('select').val(oldOpenedBuild).chosen()});
        
        oldResolvedBuild = $('#resolvedBuild').val() ? $('#resolvedBuild').val() : 0;
        link = createLink('build', 'ajaxGetProductBuilds', 'productID=' + productID + '&varName=resolvedBuild&build=' + oldResolvedBuild + '&branch=' + branch);
        $('#resolvedBuildBox').load(link, function(){$(this).find('select').val(oldResolvedBuild).chosen()});
    }
}

/**
 * Set story field.
 * 
 * @param  moduleID $moduleID 
 * @param  productID $productID 
 * @param  storyID $storyID
 * @access public
 * @return void
 */
function setStories(moduleID, productID, storyID)
{
    var branch = $('#branch').val();
    if(typeof(branch) == 'undefined') branch = 0;
    link = createLink('story', 'ajaxGetProductStories', 'productID=' + productID + '&branch=' + branch + '&moduleID=' + moduleID + '&storyID=' + storyID);
    $.get(link, function(stories)
    {
        if(!stories) stories = '<select id="story" name="story" class="form-control"></select>';
        $('#story').replaceWith(stories);
        $('#story_chosen').remove();
        $('#story').next('.picker').remove();
        $("#story").chosen();
    });
}

/**
 * Load product branches.
 * 
 * @param  int $productID 
 * @access public
 * @return void
 */
function loadProductBranches(productID)
{
    $('#branch').remove();
    $('#branch_chosen').remove();
    $('#branch').next('.picker').remove();
    $.get(createLink('branch', 'ajaxGetBranches', "productID=" + productID), function(data)
    {
        if(data)
        {
            $('#product').closest('.input-group').append(data);
            $('#branch').css('width', page == 'create' ? '120px' : '65px');
            $('#branch').chosen();
        }
    })
}


var oldAssignedToTitle = $("#assignedTo").find("option:selected").text();
var oldAssignedTo      = $("#assignedTo").find("option:selected").val();

/**
 * Load team members of the project as assignedTo list.
 *
 * @param  int     $projectID 
 * @access public
 * @return void
 */
function loadAssignedTo(projectID, selectedUser)
{
    selectedUser = (typeof selectedUser == undefined) ? '' : $('#assignedTo').val();
    link = createLink('bug', 'ajaxLoadAssignedTo', 'projectID=' + projectID + '&selectedUser=' + selectedUser);
    $.get(link, function(data)
    {
        var defaultOption = '<option title="' + oldAssignedToTitle + '" value="' + oldAssignedTo + '" selected="selected">' + oldAssignedToTitle + '</option>';
        $('#assignedTo_chosen').remove();
        $('#assignedTo').next('.picker').remove();
        $('#assignedTo').replaceWith(data);
        var defaultAssignedTo = $('#assignedTo').val();
        if(defaultAssignedTo !== oldAssignedTo && selectedUser == '') $('#assignedTo').append(defaultOption);
        $('#assignedTo').chosen();
    });
}

/**
 * notice for create build.
 * 
 * @access public
 * @return void
 */
function notice()
{
    $('#buildBoxActions').empty().hide();
    if($('#openedBuild').find('option').length <= 1) 
    {
        var html = '';
        if($('#project').length == 0 || $('#project').val() == '')
        {
            var branch = $('#branch').val();
            if(typeof(branch) == 'undefined') branch = 0;
            var link = createLink('release', 'create', 'productID=' + $('#product').val() + '&branch=' + branch); 
            if(typeof(flow) != 'undefined' && flow == 'onlyTest') link = createLink('build', 'create','projectID=' + $('#product').val());
            link += config.requestType == 'GET' ? '&onlybody=yes' : '?onlybody=yes';
            html += '<a href="' + link + '" data-toggle="modal" data-type="iframe" style="padding-right:5px">' + createBuild + '</a> ';
            html += '<a href="javascript:loadProductBuilds(' + $('#product').val() + ')">' + refresh + '</a>';
        }
        else
        {
            projectID = $('#project').val();
            html += '<a href="' + createLink('build', 'create','projectID=' + projectID) + '" target="_blank" style="padding-right:5px">' + createBuild + '</a> ';
            html += '<a href="javascript:loadProjectBuilds(' + projectID + ')">' + refresh + '</a>';
        }
        var $bba = $('#buildBoxActions');
        if($bba.length)
        {
            $bba.html(html);
            $bba.show();
        }
        else
        {
            if($('#buildBox').closest('tr').find('td').size() > 1)
            {
                $('#buildBox').closest('td').next().attr('id', 'buildBoxActions');
                $('#buildBox').closest('td').next().html(html);
            }
            else
            {
                html = "<td id='buildBoxActions'>" + html + '</td>';
                $('#buildBox').closest('td').after(html);
            }
        }
    }
}
$(function()
{
    if($('#bugList thead th.c-title').width() < 150) $('#bugList thead th.c-title').width(150);

    if(flow == 'onlyTest')
    {
        $('#subNavbar > .nav li[data-id=' + browseType + ']').addClass('active');
        var $more = $('#subNavbar > .nav > li[data-id=more]');
        if($more.find('.dropdown-menu').children().length)
        {
            $more.find('.dropdown-menu').children().each(function()
            {
                if($(this).hasClass('active')) $more.addClass('active');
            });
        }

        var navWidth = $('#subNavbar > .nav').width();
        var leftWidth  = 0;
        var rightWidth = 0;

        $rightNav = $('#subNavbar > .nav > li.right');
        rightLength = $rightNav.length;
        for(i = 0; i < rightLength; i++) rightWidth += $rightNav.eq(i).width();

        var maxWidth = navWidth - $('#subNavbar > .nav > #bysearchTab').width() - rightWidth - 100;

        $('#subNavbar > .nav > li:not(.right)').each(function()
        {
            if(leftWidth > maxWidth)
            {
                if($(this).attr('id') != 'moreMenus' && $(this).attr('id') != 'bysearchTab')
                {
                    $('#subNavbar').removeClass('hidden');
                    $('#subNavbar > ul').append($(this)[0]);
                }
            }
            else
            {
                leftWidth += $(this).width();
            }
        })
    }
});

</script>
<div class='hidden'><script type="text/javascript">var cnzz_protocol = (("https:" == document.location.protocol) ? " https://" : " http://");document.write(unescape("%3Cspan id='cnzz_stat_icon_4553360'%3E%3C/span%3E%3Cscript src='" + cnzz_protocol + "s5.cnzz.com/stat.php%3Fid%3D4553360' type='text/javascript'%3E%3C/script%3E"));</script></div>
</body>
</html>
